package org.hxyjs.dao.impl;

import org.hxyjs.dao.WinningrecordDao;
import org.hxyjs.entity.Winningrecord;
import org.hxyjs.mapper.WinningrecordMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

@Repository("winningrecordDao")//一般实现类不会直接生成默认对象名 而是使用 接口的默认对象名
public class WinningrecordDaoImpl implements WinningrecordDao {
    @Resource //autowired 会装配能够直接扫描到的对象  resource spring容器运行的时候才找到需要的对象  注入
    private WinningrecordMapper winningrecordMapper;
    public List<Winningrecord>  getAllWinningrecords() throws Exception{
        return winningrecordMapper.selectByExample(null);
    }

    @Override
    public Integer deleteWinningrecordByWrno(String wrno)  throws Exception{
        return winningrecordMapper.deleteByPrimaryKey(wrno);
    }

    @Override
    public Integer updateWinningrecordByWrno(Winningrecord winningrecord)  throws Exception{
        return winningrecordMapper.updateByPrimaryKey(winningrecord);
    }

    @Override
    public Integer addWinningrecord(Winningrecord winningrecord)  throws Exception{
        return winningrecordMapper.insertSelective(winningrecord);
    }

}
